import Storage from './storage'
import Axios from 'axios'
import { BASE_URL } from '../env'
Axios.defaults.baseURL = BASE_URL
Axios.defaults.headers.common['Authorization'] = `Bearer ${Storage.getItem('access_token')}`
Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
let Request = {
  authorize (data) {
    return Axios.post('/oauth/token', data)
    .then(res => {
      return res.data
    }).catch(err => {
      console.log(err)
    })
  }
}

export default Request
